home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tex / mf / inputs / misc / xyqc10.mf < prev   
Text File  |  1995-03-15  |  3KB  |  92 lines

  1. % $Id: xyqc10.mf,v 2.6 1992/06/24 01:23:34 kris Exp $ -*-tex-*-
  2. %
  3. % XYQC10: quarter circles for XY mode at 10 point.
  4. % Copyright (c) 1992  Kristoffer H. Rose  <kris@diku.dk>
  5. %
  6. % This file is part of the XY-pic macro package.
  7. %
  8. % The XY-pic macro package is free software; you can redistribute it and/or
  9. % modify it under the terms of the GNU General Public License as published by
  10. % the Free Software Foundation; either version 2 of the License, or (at your
  11. % option) any later version.
  12. %
  13. % The XY-pic macro package is distributed in the hope that it will be
  14. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
  16. % Public License for more details.
  17. %
  18. % You should have received a copy of the GNU General Public License along
  19. % with this macro package; if not, write to the Free Software Foundation, Inc.,
  20. % 675 Mass Ave, Cambridge, MA 02139, USA.
  21. %
  22. % CONTENTS: Quarter circles in all directions:
  23. %
  24. %                        -.
  25. %                            |   )   |  /\
  26. %        o    o    o    o-'  o    o    o  .-o    o
  27. %       (     |_    \/                    |     (
  28. %
  29. % Code:   [-1]   15   31   47   65   79   95  111  127
  30. %
  31. % Each character has a cosinoid bounding box :-) with wd = cos I = sin F,
  32. % where I,F are the angles from direction --> to the initial,final direction.
  33. %
  34. font_identifier "XYQC"; font_size 10pt#;
  35. font_coding_scheme:="XY quarter circles";
  36. mode_setup;
  37.  
  38. % METANESS...
  39. %
  40. qcd# = 1/2 designsize;    % quarter circle diameter
  41. rulew# = .4pt#;        % quarter circle line width
  42. define_pixels(qcd,rulew);
  43. %
  44. % beginqc draws the quarter circle starting in the direction towards endpoint
  45. % and turning left...
  46. def beginqc(expr cc,ex,ey) =
  47.  alpha := angle (ex,ey);
  48.  cw := sqrt(1/2) * abs(sind(alpha + 135));
  49.  beginchar(cc,cw*qcd#,0,0);
  50.  pickup pencircle scaled rulew rotated (alpha - 90);
  51.  if (cc<64): draw quartercircle shifted (-.5,0) rotated (alpha - 90)
  52.     scaled qcd
  53.  else: draw quartercircle shifted (-.5,0) rotated (alpha - 90) shifted (cw,0)
  54.     scaled qcd
  55.  fi
  56. enddef;
  57.  
  58. % TESTING...we redefine openit because the characters extend far to the
  59. % left of the bounding box!
  60. %
  61. def openit = openwindow currentwindow
  62.  from origin to (screen_cols,screen_rows) at (-200,200) enddef;
  63.  
  64. % FONT.
  65. %
  66. % Font dimension 8 is the rule thickness (cf. The TeXbook, app.G).
  67. fontdimen 8: rulew#;
  68. %
  69. % Here are the characters...
  70. %
  71. for cc = 0 step 1 until 31:
  72.  beginqc(cc,cc-15,-16); endchar;
  73. endfor;
  74. %
  75. for cc = 32 step 1 until 63:
  76.  beginqc(cc,16,cc-47); endchar;
  77. endfor;
  78. %
  79. for cc = 64 step 1 until 95:
  80.  beginqc(cc,79-cc,16); endchar;
  81. endfor;
  82. %
  83. for cc = 96 step 1 until 127:
  84.  beginqc(cc,-16,111-cc); endchar;
  85. endfor;
  86.  
  87. bye.
  88. %
  89. % $Log: xyqc10.mf,v $
  90. % Revision 2.6  1992/06/24  01:23:34  kris
  91. % Implemented and used for hooks.
  92.